package com.dy.design_pattern_study.mediator_pattern.dome1;

import com.dy.design_pattern_study.mediator_pattern.dome1.impl.ConcreteColleague1;
import com.dy.design_pattern_study.mediator_pattern.dome1.impl.ConcreteColleague2;
import com.dy.design_pattern_study.mediator_pattern.dome1.impl.ConcreteMediator;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-23
 * @Content
 */
public class client {
    public static void main(String[] args) {
        ConcreteMediator m = new ConcreteMediator();

        //设置 中介对象 -让两个具体同事认识中介对象
        ConcreteColleague1 c1 = new ConcreteColleague1(m);
        ConcreteColleague2 c2 = new ConcreteColleague2(m);

        //设置具体同事类 -让中介者认识具体的同事
        m.setColleague1(c1);
        m.setColleague2(c2);

        //具体同事类对象发送信息都需要通过中介者进行转发
        c1.send("你吃饭了吗？");
        c2.send("没捏！");
    }
}
